package cn.gok.service.impl;

import cn.gok.dao.SecurityQuestionDao;
import cn.gok.service.SecurityQuestionService;
import cn.gok.util.Sqlsessionutil;
import cn.gok.util.R;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class SecurityQuestionServiceImpl implements SecurityQuestionService {
    private SqlSession sqlSession;
    private SecurityQuestionDao securityQuestionDAO;

    public SecurityQuestionServiceImpl(){
        sqlSession = Sqlsessionutil.getSqlSessionFactory().openSession();
        securityQuestionDAO = sqlSession.getMapper(SecurityQuestionDao.class);
    }


    @Override
    public R getAllQuestion() {
        List<String> allQuestion = securityQuestionDAO.getAllQuestion();
        return R.create(allQuestion);
    }

    @Override
    public int addQuestion(String question) {
        return 0;
    }
}
